{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2016, OpenNebula Project, OpenNebula Systems                }}
{{!                                                                            }}
{{! Licensed under the Apache License, Version 2.0 (the "License"); you may    }}
{{! not use this file except in compliance with the License. You may obtain    }}
{{! a copy of the License at                                                   }}
{{!                                                                            }}
{{! http://www.apache.org/licenses/LICENSE-2.0                                 }}
{{!                                                                            }}
{{! Unless required by applicable law or agreed to in writing, software        }}
{{! distributed under the License is distributed on an "AS IS" BASIS,          }}
{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   }}
{{! See the License for the specific language governing permissions and        }}
{{! limitations under the License.                                             }}
{{! -------------------------------------------------------------------------- }}

<div id="{{dialogId}}" class="large reveal" role="dialog" data-reveal >
  <div class="row">
    <div class="large-12 columns">
      <h3 class="subheader">{{tr "Login Token"}}</h3>
    </div>
  </div>
  <div class="confirm-resources-header"></div>
  <div class="reveal-body">
    <div class="row">
      <div class="large-12 columns">
        <br/>
        <p>
          {{tr "A login token acts as a password and can be used to authenticate with OpenNebula through Sunstone, the CLI, or the API"}}
        </p>
      </div>
    </div>
    {{#if tokens}}
    <div class="row">
      <div class="large-12 columns">
        <table>
          <thead>
            <tr>
              <th>{{tr "Valid until"}}</th>
              <th>{{tr "Target Group"}}</th>
              <th>{{tr "Token"}}</th>
              <th></th>
            </tr>
          </thead>
          <tbody>
          {{#each tokens}}
            <tr>
              <td>{{humanizeTime EXPIRATION_TIME}}</td>
              <td>{{EGROUP}}</td>
              <td class="token-text"><pre>{{TOKEN}}</pre></td>
              <td>
                <a href="#"><i class="fa fa-times-circle remove-tab"></i></a>
              </td>
            </tr>
          {{/each}}
          </tbody>
        </table>
      </div>
    </div>
    {{/if}}
    <br/>
    <div class="row">
      <div class="large-4 medium-6 columns">
        <label>
          {{tr "Expiration, in seconds"}}
          <input class="token-expiration" type="number" value="36000"/>
        </labe>
      </div>
      <div class="large-4 medium-6 columns end">
        <label>
          {{tr "Group"}}
          <div class="token-group-selector"/>
        </labe>
      </div>
      <div class="large-4 medium-6 columns end">
        <label>&nbsp;</label>
        <button id="token_btn" type="button" class="button radius">
          {{tr "Get a new token"}}
        </button>
      </div>
    </div>
    <button class="close-button" data-close aria-label="{{tr "Close modal"}}" type="button">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
</div>
